package com.chinasoft04.mall.dto;

import org.apache.ibatis.jdbc.SQL;

public class GoodSql {
    public String updateGoodSql(final Integer id,final Good good){
        SQL sql = new SQL(){
            {
                UPDATE("sp_goods");
                SET("goods_name = #{goods_name}");
                SET("goods_price = #{goods_price}");
                SET("goods_number = #{goods_number}");
                SET("goods_weight = #{goods_weight}");
                if (!good.getGoods_introduce().equals(""))
                    SET("goods_introduce = #{goods_introduce}");
                WHERE("goods_id = #{goods_id}");
            }


        };


        System.out.println("执行sql语句："+sql.toString());
        return sql.toString();
    }
}
